package cn.dengxin.springcloud.helloservice;

import com.example.helloserviceapi.HelloService;
import com.example.helloserviceapi.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author:   dengxin
 * Date:     2020/5/7 6:19 下午
 */

@RestController
public class RefactorHelloController implements HelloService {

    @Override
    public String hello(@RequestParam String name) {
        return "Hello " + name;
    }

    @Override
    public User hello(@RequestHeader String name, @RequestHeader Integer age) {
        return new User(name, age);
    }

    @Override
    public String hello(@RequestBody User user) {
        return "Hello " + user.getName() + ", " + user.getAge();
    }
}
